//处置方法
function reset(){
    $("#username").text("");
    $("#password").text("");
}
// 去掉空格
function trim(value) {
    if (value){
        value = value.replace(/^\s*|\s*$/g, "");
    }
    if (!value){
        return "";
    }
    else{
        return value;
    }
}
window.onload=function (ev) {
    $("#username").val(window.localStorage.getItem("username"));
    $("#password").val(window.localStorage.getItem("password"));
}
$(function () {
    $("#login").bind('click',function () {
        var username = trim($("#username").val());
        var password = trim($("#password").val());
        if (username==="") {
            alert("请输入用户名");
            return;
        }
        if (password==="") {
            alert("请输入密码");
            return;
        }
        if ($('input:radio[name="usercheck"]:checked').val()){
            console.log("记住用户名");
            window.localStorage.setItem("username",username,10)
        }
        if ($('input:radio[name="pwdcheck"]:checked').val()){
            console.log("记住密码");
            window.localStorage.setItem("password",password,10)
        }
    })
})
